package com.util.iso
{
	import com.util.Point3D;
	
	import flash.geom.Point;

	public class IsoUtil
	{
		public function IsoUtil()
		{
		}
		
		public static const Y_CORRECT:Number = Math.cos(-Math.PI / 6) * Math.SQRT2;
		public static function isoToFlat(p:Point3D):Point {
			var newX:Number = p.x - p.z;
			var newY:Number = p.y * Y_CORRECT + (p.x + p.z) * .5;
			return new Point(newX, newY);
		}
		
		public static function flatToIso(p:Point):Point3D {
			var newX:Number = p.y + p.x * .5;
			var newZ:Number = p.y - p.x * .5;
			return new Point3D(newX, 0, newZ);
		}
 	}
}